/**
 * Created by apple on 2016/12/9.
 */
var User = require('./db')['user'];

User.findById = function (user_id) {
    return User.findOne({where: {id:user_id}});
};

User.findByEmail = function (User_email) {
    return User.findOne({where: {
        email: User_email
    }});
};

User.updatePwd = function (user_id, pwd) {
    return User.update({
        password: pwd
    },{
        where:{id: user_id}
    })
};

User.deleteByEmail = function (user_email) {
    return User.destroy({
        where: {
            email: user_email
        }
    });
};

module.exports = User;